package com.leejie.service;

import com.leejie.mapper.HelloDao;
import com.mysql.jdbc.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class HelloService {

    @Autowired
    private HelloDao helloDao;

    public List<HashMap<String, Object>> selectUser() throws InterruptedException {
//        Thread.sleep(5000);
        return helloDao.selectUser();
    }

    public String insertLog(String log) {
        Integer res = helloDao.insertLog(log);
        if (!StringUtils.isNullOrEmpty(String.valueOf(res))){
            return "日志已成功添加到数据库...";
        }else {
            return "日志添加失败...";
        }
    }
}
